package com.hao.nettyrpc.test.client;

import com.hao.nettyrpc.api.ByeService;
import com.hao.nettyrpc.api.HelloService;
import com.hao.nettyrpc.api.HelloObject;
import com.hao.nettyrpc.serializer.CommonSerializer;
import com.hao.nettyrpc.transport.RpcClient;
import com.hao.nettyrpc.transport.RpcClientProxy;
import com.hao.nettyrpc.transport.netty.client.NettyClient;

/**
 * @author haoge
 * @version 1.0
 * @date 2023/4/11 13:58
 */
public class NettyTestClient {
    public static void main(String[] args) {
        RpcClient client = new NettyClient(CommonSerializer.PROTOBUF_SERIALIZER);
        RpcClientProxy proxy = new RpcClientProxy(client);
        HelloService helloService = proxy.getProxy(HelloService.class);
        HelloObject object = new HelloObject(12,"this is a message");
        String res = helloService.hello(object);
        System.out.println(res);
        ByeService byeService = proxy.getProxy(ByeService.class);
        System.out.println(byeService.bye("Netty"));
    }
}
